﻿using System.Collections.Generic;
using WebMatrix.Security;
using WebMatrix.WebData;

/// <summary>
/// Summary description for AuthWebSecurity
/// </summary>
public class AuthWebSecurity
{
    public AuthWebSecurity()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    public static void CreateOrUpdateAccount(string providerName, string providerUserId, string userName)
    {
        OAuthWebSecurity.CreateOrUpdateAccount(providerName, providerUserId, userName);
    }

    /// <summary>
    /// SiteSecurity.CurrentUserName will be taken as Logged In User
    /// </summary>
    /// <param name="providerName"></param>
    /// <param name="providerUserId"></param>
    public static void CreateOrUpdateAccount(string providerName, string providerUserId)
    {
        OAuthWebSecurity.CreateOrUpdateAccount(providerName, providerUserId, SiteSecurity.CurrentUserName);
    }

    public static void DeleteAccount(string providerName, string providerUserId)
    {
        OAuthWebSecurity.DeleteAccount(providerName, providerUserId);
    }

    public static IList<OAuthAccountData> GetAccountsForUser(string userName)
    {
        return OAuthWebSecurity.GetAccountsForUser(userName);
    }

    public static IList<OAuthAccountData> GetAccountsForUser()
    {
        return OAuthWebSecurity.GetAccountsForUser(SiteSecurity.CurrentUserName);
    }

    public static bool Login(string providerName, string providerUserId)
    {
        return OAuthWebSecurity.Login(providerName, providerUserId);
    }

    public static void RequestAuthentication(string provider)
    {
        OAuthWebSecurity.RequestAuthentication(provider);
    }

    public static AuthenticationResult VerifyAuthentication()
    {
        return OAuthWebSecurity.VerifyAuthentication();
    }
}